<template>
	<view class="con-box">
		<u-navbar title="" height="120upx">
			<view class="u-nav-slot" slot="left">
				<view @tap="back" class="icon-left">
					<u-icon name="arrow-left" color="#fff" size="26"></u-icon>
				</view>
			</view>
			<view class="u-nav-slot logoBox" slot="center">
				<view class="navBox">
					产品详情
				</view>
			</view>
			<view class="u-nav-slot" slot="right">
				<view class="icon-right">
					<view class="backImg-right">
						<!-- <image @tap="shareFx" class="share" src="../../static/common/share.png" mode=""></image> -->
					</view>
				</view>
			</view>
		</u-navbar>
		
		<view class="goods-image">
			<view v-if="setImgShow(myGoodsDetails) == 1">
				<image class="img" :src="myGoodsDetails.coverImg" mode="scaleToFill">
				</image>
			</view>
			<view v-else-if="setImgShow(myGoodsDetails) == 2">
				<video class="videoBox" :enable-progress-gesture="false" :src="myGoodsDetails.coverImg" muted
					:autoplay="false" :controls="false" loop></video>
			</view>
			<view v-else-if="setImgShow(myGoodsDetails) == 3">
				<view class="mask"></view>
				<iframe class="iframeBox" :src="`/hybrid/html/3d.html?modelUrl=${myGoodsDetails.coverImg}`"></iframe>
				<image @tap="model3dShow = true;stop()" class="model3d" src="../../static/detail/model3d.png" mode="widthFix"></image>
			</view>
		</view>
		
		<view class="goods-desc">
			<view class="goods_details">
				<view class="title">
					<view>{{myGoodsDetails.seriesName}}</view>
					<view v-for="(item,i) in myGoodsDetails.labelList" :key="i">{{item}}</view>
					
				</view>
				<view class="name">
					<text class="castNameS">{{myGoodsDetails.collName}}</text>
					<view>
						<image v-if="setImgShow(myGoodsDetails) == 1" src="@/static/home/fileType1.png" mode="widthFix"></image>
						<image v-else-if="setImgShow(myGoodsDetails) == 2" src="@/static/home/fileType2.png" mode="widthFix"></image>
						<image v-else-if="setImgShow(myGoodsDetails) == 3" src="@/static/home/fileType3.png" mode="widthFix"></image>
					</view>
				</view>
			</view>
			
			<view class="infoBox">
				<view class="code">
					<view class="lCont">
						产品编号<text>#{{myGoodsDetails.sortSn}}/{{myGoodsDetails.castingAmount}}</text>
					</view>
				</view>
				<view>合约地址<text>{{myGoodsDetails.treatyAddress}}</text></view>
				<view>生成时间<text>{{myGoodsDetails.created}}</text></view>
			</view>
			
			<view class="scrollIssuer">
				<view class="holder-info dfs">
					<view class="contLeft">
						<image class="img" :src="myGoodsDetails.issuerHeads" mode="scaleToFill"></image>
						<view class="desc">
							<view class="desc_1">{{myGoodsDetails.issuerNames || "----"}}<text>发行方</text></view>
							<!-- <view class="desc_2">{{myGoodsDetails.issuerNames}}</view> -->
						</view>
					</view>
					<!-- <u-icon name="arrow-right" color="#414141" size="30upx"></u-icon> -->
				</view>
				
				<!-- <view class="holder-info dfs">
					<view class="contLeft">
						<image class="img" :src="myGoodsDetails.issuerHeads" mode="scaleToFill"></image>
						<view class="desc">
							<view class="desc_1">{{myGoodsDetails.nickname || "----"}}<text>持有方</text></view>
							<view class="desc_2">{{myGoodsDetails.issuerNames}}</view>
						</view>
					</view>
				</view> -->
			</view>
			
			<view class="privilegeBox">
				<view class="titles">持有特权</view>
				<view class="contents">
					<view class="privilege" @tap="goApplet(0)">
						<image src="../../static/detail/image1.png" mode="widthFix"></image>
						<view>IP文库</view>
					</view>
					<view class="privilege" @tap="goApplet(1)">
						<image src="../../static/detail/image2.png" mode="widthFix"></image>
						<view>文创产品</view>
					</view>
				</view>
			</view>
			<view class="image-desc">
				<view class="title">
					<text>产品详情</text>
				</view>
				<view class="show-image">
					<image v-for="(item,index) in myGoodsDetails.applyInfoList" :key="index" mode="widthFix" class="img"
						:src="item"></image>
				</view>
			</view>
			
			
			<view class="image-desc">
				<view class="title1">
					<text class="name">转让记录</text>
					<text class="more" @tap="show1 = true">查看更多</text>
				</view>
				<view v-for="(item,index) in transactionsList.slice(0,6)" :key="index">
					<view class="circulationRecord" v-if="item.sellTime">
						<view class="lCont">
							<text class="date">{{item.sellTime}}</text>
						</view>
						<view class="rCont">出售</view>
					</view>
					<view class="circulationRecord">
						<view class="lCont">
							<text class="tag">上链时间</text>
							<text class="date">{{item.created}}</text>
						</view>
						<view class="rCont">受让</view>
					</view>
				</view>
				
				<view class="circulationRecord">
					<view class="lCont1">
						<text class="name">中国数字图书馆</text>
						<text class="date">{{itemDetails.startTime}}</text>
					</view>
					<view class="rCont1">发售</view>
				</view>
				<view class="circulationRecord noBorder">
					<view class="lCont1">
						<text class="name">中国数字图书馆</text>
						<text class="date">{{myGoodsDetails.created}}</text>
					</view>
					<view class="rCont1">发布</view>
				</view>
			</view>
		</view>
		<!--status 0冻结1可用（可转售）-1已转售2挂单中 -->
		<view class="operating">
			<view class="footBox">
				<view class="footLeft">查看证书</view>
				<view class="buttS">
					<view class="shopping0"  v-if="myGoodsDetails.status == 1 && myGoodsDetails.isSell">
						<view @tap="sellGoodsFn()">立即挂单</view>
					</view>
					<view class="shopping0"  v-else-if="myGoodsDetails.status == 2">
						<view @tap="cancelSell()">取消挂单</view>
					</view>
					<view class="shopping1" v-else>立即挂单<u-icon @tap="tipsShow = true" class="iconfs" name="question-circle" color="#fff" size="26upx"></u-icon></view>
				</view>
			</view>
		</view>
		
		<!-- 转让记录 -->
		<u-popup :closeable="true" mode="bottom" :show="show1" @close="show1 = false" :round="0">
			 <view class="prize">
				<view class="prizeTitle">转让记录</view>
				<view class="prizeBox">
					<scroll-view @scrolltolower="scrolltolower" scroll-y="true" style="width: 100%;height: 540upx;">
						<view class="prizeList">
							<view v-for="(item,index) in transactionsList" :key="index">
								<view class="prizeItem" v-if="item.sellTime">
									<view class="prizeText prizeRecord">
										<view>{{item.sellTime}}</view>
									</view>
									<view class="prizeText1">出售</view>
								</view>
								<view class="prizeItem">
									<view class="prizeText prizeRecord">
										<view><text>上链时间</text>{{item.created}}</view>
									</view>
									<view class="prizeText1">受让</view>
								</view>
							</view>
							
							<view class="prizeItem">
								<view class="prizeText nameCt">
									<text>中国数字图书馆</text>
									<view>{{itemDetails.startTime}}</view>
								</view>
								<view class="prizeText1">发售</view>
							</view>
							<view class="prizeItem">
								<view class="prizeText nameCt">
									<text>中国数字图书馆</text>
									<view>{{myGoodsDetails.created}}</view>
								</view>
								<view class="prizeText1">发布</view>
							</view>
						</view>
						<view class="msg" v-if="isEnd">— 没有更多了 —</view>
					</scroll-view>
				</view>
			 </view>   
		</u-popup>
		
		<u-popup :show="payShow" bg-color="#141414" mode="bottom">
			<view class="payPasTitle" v-if="showType == 2">
				<text>转让密码</text>
				<u-icon name="close" class="closeIcon" color="#999" @tap="guanbi" size="34upx"></u-icon>
			</view>
			<view class="modeTitle" v-else>
				<text>出售确认</text>
				<u-icon name="close" color="#fff" @tap="guanbi" size="34upx"></u-icon>
			</view>
			<view class="shop-tips" :style="{'min-height':showType==2?'620upx':'760upx'}">
				<view class="tip-image step1" v-if="showType == 0">
					<u-loading-icon inactive-color="red" size="80upx" color="#352070"></u-loading-icon>
					<text>转让请求中...</text>
				</view>
				
				<view class="tip-image step3" v-else-if="showType == 2">
					<view class="password">
						<view class="flex">
							<view class="password_num" v-for="(item,index) in miney_list">
								<view class="inputCont" v-if="item.id == index">
									<view v-for="(res,i) in payPas.payPsw.length" v-show="i == index">
										<view class="miney_data"></view>
									</view>
								</view>
							</view>
						</view>
						<input v-model="payPas.payPsw" :focus="payPas.setFocus" maxlength="6" type="number" value="123" @input="input_num">
					</view>
				</view>
				
				<view class="tip-image step2" v-else>
					<view class="tips">出售成功后将会扣除手续费和版权费，到账时间取决于售出时间。</view>
					<view class="goods">
						<image v-if="isImage(myGoodsDetails.fileUrl)" :src="myGoodsDetails.fileUrl"
							mode="scaleToFill" class="img"></image>
						<image v-else :src="myGoodsDetails.fileUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'"
							mode="scaleToFill" class="img"></image>
						<view class="info">
							<view class="name">{{myGoodsDetails.collName}}</view>
							<text>产品ID{{myGoodsDetails.id}}</text>
						</view>
					</view>
					<view class="priceCont">
						当日指导价 <text>¥{{resaleCasting.newOpenPrice || 0}}</text>，定价最高限价<text>¥{{resaleCasting.riseStopPrice || 0}}</text>
						<u-icon @tap="tipsShowFn(4)" class="iconfs" name="question-circle" color="#999" size="26upx"></u-icon>
					</view>
					
					<view class="items">
						<text>出售金额</text>
						<view class="price"><input type="number" @input="moneyChange" v-model="payPas.money" placeholder="请填写出售金额" /></view>
					</view>
					<view class="itemBox">
						<view>平台手续费<u-icon @tap="tipsShowFn(1)" class="iconfs" name="question-circle" color="#999" size="30upx"></u-icon></view>
						<text>￥{{Number(serviceCharge.sellMoney).toFixed(2)}}</text>
					</view>
					<view class="itemBox">
						<view>版权费<u-icon @tap="tipsShowFn(2)" class="iconfs" name="question-circle" color="#999" size="30upx"></u-icon></view>
						<text>￥{{Number(serviceCharge.sellCopyrightMoney).toFixed(2)}}</text>
					</view>
					<view class="itemBox">
						<view>发行方服务费<u-icon @tap="tipsShowFn(3)" class="iconfs" name="question-circle" color="#999" size="30upx"></u-icon></view>
						<text>￥{{Number(serviceCharge.sellIssueMoney).toFixed(2)}}</text>
					</view>
					<view class="items">
						<text>实际到账金额</text>
						<view class="myMoney">￥{{Number(serviceCharge.myMoney).toFixed(2)}}</view>
					</view>
				</view>
				
				<view class="footBn" v-if="showType == 1">
					<view :class="[isApiFlag?'style2':'style1']" @tap="nextPas">下一步输入转让密码</view>
				</view>
				
				<view class="footBn" v-else-if="showType == 401">
					<view class="style2" @tap="tocertification(1)">前往登录</view>
				</view>
				<view class="footBn" v-else-if="showType == 6">
					<view class="style1">{{resMsg}}</view>
				</view>
				<view class="footBn" v-else-if="showType == 2">
					<view :class="[payPas.payPsw.length==6?'style2':'style1']" @tap="sellGoodsApi">确认转售</view>
				</view>
			</view>
		</u-popup>
		
		<u-popup :show="cancelSsellShow" :round="10" :customStyle="{width:'620upx'}" mode="center">
			<view class="shop_tips">
				<view class="tip-title">确定取消吗？</view>
				<view class="cont">取消挂单后，产品可在我的持有中查看</view>
				<view class="tip-text">
					<view class="text" @tap="cancelSsellShow = false">
						再想想
					</view>
					<view class="text1" @tap="confirm">
						确定
					</view>
				</view>
			</view>
		</u-popup>
		
		<!-- //3d模型 -->
		<u-popup :show="model3dShow" @close="model3dShow = false;move()" bgColor="transparent" mode="center" round="20upx">
			<view class="model3dPopup">
				<iframe class="iframeBox" :src="`/hybrid/html/3d.html?modelUrl=${myGoodsDetails.coverImg}`"></iframe>
			</view>
		</u-popup>
		
		<u-popup :show="tipsShow" :round="10" :customStyle="{width:'90%'}" mode="center">
			<view class="shop-tipsBox">
				<view class="tip-title">{{myGoodsDetails | tipsTitle}}</view>
				<view class="tip-text">
					<view class="text" @tap="tipsShow = false">知道了</view>
				</view>
			</view>
		</u-popup>
		<view class="toastBox" v-show="errMsgShow">{{errMsg}}</view>
		<mix-loading ref="min_loading"></mix-loading>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import {getWeixinConfig,getSeriesCollInfo} from '@/api/home.js'
	import {
		getUser,getMyGoodsDetail,getAccountData,sellGoods,offGoods,getResaleCasting,countAssestService,getNftuserdetaillogList
	} from '../../api/user.js'
	import html2canvas from "html2canvas";
	import uQRCode from '@/common/uqrcode.js'
	
	import {
	    mapState ,mapMutations
	} from 'vuex'; 
	import wx from 'jweixin-module';
	import sha1 from '@/common/sha1.js'; 
	export default {
		data() {
			return {
				itemDetails:{},
				model3dShow:false,
				cancelSsellShow:false,
				//出售
				showType:1,
				payShow:false,
				miney_list: [
					{id: 0,name: ''},
					{id: 1,name: ''},
					{id: 2,name: ''},
					{id: 3,name: ''},
					{id: 4,name: ''},
					{id: 5,name: ''},
				],
				payPas:{
					orderId:"",
					type:"3",
					payPsw:"",
					setFocus:false,
					money:""
				},
				tipsShow:false,
				
				show1: false,
				transactionsList:[],//转让记录
				myGoodsDetails: {},
				goAppletUrl:null,
				isWxOpen:false,
				listQuery: {
					page: 1,
					pageSize: 10,
					pages:1,
					detailId:"",
				},
				isEnd:false,
				userAccount:{},
				errMsg:"",
				errMsgShow:false,
				errMsgTime:null,
				resaleCasting:{},//转售市场藏品信息
				timerFn:null,
				serviceCharge:{
					sellMoney:0,//买方平台服务费
					sellCopyrightMoney:0,//买方版权服务费
					sellIssueMoney:0,//发行方服务费
					myMoney:0
				},
				isApiFlag:false
			};
		},
		onShow(){
			this.getAccount();
		},
		onLoad(option) {
			this.getDetails(option.id,option.castingId);
			this.getConfig();
		},
		filters:{
			tipsTitle(data){
				let str = "",status = data.status;
				if(status || status == 0 || status == -1){
					if(status == 0){
						str = "产品已冻结！";
					}else if(status == -1){
						str = "产品已转售！";
					}else if(status == 2){
						str = "该产品已在挂单中！";
					}else if(status == 1 || !data.isSell){
						str = data.tipsTxt;
					}
				}
				return str;
			}
		},
		computed:{
			...mapState(["hasLogin","uerInfo"]),
			userData(){
			  let data = {};
			  if(this.$store.state.hasLogin && this.$store.state.uerInfo){
				data = this.$store.state.uerInfo;
				data["avatarUrl"] = data.headPortraitUrl?this.pathImg+data.headPortraitUrl:require("../../static/detail/avatar.png");
				data["name"] = data.nickname?data.nickname:"第"+data.id+"位数字藏家";
			  }
			  return data;
			},
		},
		methods: {
			scrolltolower(){//流转记录
				if(this.listQuery.pages > this.listQuery.page){
					this.listQuery.page++;
					this.getRecordData();
				}
			},
			getRecordData(){//流转记录
				getNftuserdetaillogList(this.listQuery).then(res => {
					if (res.data.rows) {
						this.listQuery.pages = res.data.totalPage;
						
						let newList = res.data.rows.filter((item, index) => {
							return item;
						});
						
						if (this.listQuery.page == 1) {
							this.transactionsList = [...newList];
						} else {
							this.transactionsList = [...this.transactionsList,...newList];
						}
					}
				}).catch(err=>{
				});
			},
			getDetails(id,castingId){//获取详情
				getSeriesCollInfo({id:castingId}).then(res => {
					if(res.data.success){
						let obj = res.data.obj;
						this.itemDetails = obj;
					}
				});
				getMyGoodsDetail({id}).then(res => {
					if (res.data.success) {
						let data = res.data.obj;
						this.listQuery.detailId = data.castingInfoId;
						this.getRecordData();//流转记录
						if(data.issuerHead){
							data["issuerHeadList"] = ((data.issuerHead).split(',')).map(item => {
								item = this.pathImg + item;
								return item;
							});
							data["issuerHeads"] = data["issuerHeadList"][0];
						}
						if(data.describeFile){
							data["applyInfoList"] = ((data.describeFile).split(',')).map(item => {
								item = this.pathImg + item;
								return item;
							});
						}
						
						if(data.issuerName){
							data["issuerNameList"] = (data.issuerName).split(',');
							data["issuerNames"] = data["issuerNameList"][0];
						}
						if(data.fileUrl){
							data.fileUrl = this.pathImg + data.fileUrl;
						}
						
						if(data.coverImg){
							data.coverImg = this.pathImg + data.coverImg;
						}
						if(data.label){
							if(data.label.indexOf(",") != -1){
								data["labelList"] = data.label.split(',');
							}else{
								let labelList = data.label.split('#');
								labelList = labelList.map(im=>{
									im = ("#" + im);
									return im;
								});
								data["labelList"] = labelList.filter((im,i)=>{
									return i>0;
								});
							}
						}
						this.myGoodsDetails = data;
						getResaleCasting({castingId:data.castingId}).then(res => {//转售市场藏品信息
							if (res.data.success) {
								let data = res.data.obj;
								this.resaleCasting = data;
								this.myGoodsDetails["isSell"] = true;
								this.myGoodsDetails["tipsTxt"] = "";
							} else {
								this.myGoodsDetails["isSell"] = false;
								this.myGoodsDetails["tipsTxt"] = res.data.msg;
							}
						}).catch(err => {
							this.$u.toast('网络错误');
						});
					}else{
						
					}
				}).catch(err=>{});
			},
			//禁止页面滑动
			stop(){
				  var box=function(e)
				  {passive: false ;};
				  document.body.style.overflow='hidden';
				  document.addEventListener("touchmove",box,false);
			},
			 //允许页面滑动
			move(){
				var box=function(e){passive: false };
				document.body.style.overflow='';//出现滚动条
				document.removeEventListener("touchmove",box,false);
			},
			tipsShowFn(i){
				if(i == 1){
					let sellFloat = this.serviceCharge.sellFloat;
					this.myGoodsDetails["tipsTxt"] = sellFloat?sellFloat+"%"+"的平台服务手续费！":"平台服务手续费！";
				}else if(i == 2){
					let sellCopyrightFloat = this.serviceCharge.sellCopyrightFloat;
					this.myGoodsDetails["tipsTxt"] = sellCopyrightFloat?sellCopyrightFloat+"%"+"的产品版权费！":"产品版权费！";
				}else if(i == 3){
					let sellIssueFloat = this.serviceCharge.sellIssueFloat;
					this.myGoodsDetails["tipsTxt"] = sellIssueFloat?sellIssueFloat+"%"+"的产品发行方服务费用！":"产品发行方服务费用！";
				}else if(i == 4){
					this.myGoodsDetails["tipsTxt"] = `当日指导价指今日的开盘价，定价最高限价指涨停价`;
				}
				this.tipsShow = true;
			},
			moneyChange(){
				this.isApiFlag = false;
				clearTimeout(this.timerFn);
				this.timerFn = setTimeout(()=>{
					this.getcountAssestService();
				},1000);
			},
			getcountAssestService(){
				countAssestService({
					assetsId: this.myGoodsDetails.id,
					price:this.payPas.money
				}).then(res => {
					if (res.data.success) {
						let data = res.data.obj,money = 0;
						this.serviceCharge = data;
						money = (Number(this.payPas.money) - (data.sellMoney + data.sellCopyrightMoney + data.sellIssueMoney));
						this.serviceCharge["myMoney"] = money <= 0 ?0:money;
						
						if(this.payPas.money == "" || this.payPas.money < this.resaleCasting.fallStopPrice || this.payPas.money > this.resaleCasting.riseStopPrice){//	跌停价
							this.isApiFlag = false;
						}else{
							this.isApiFlag = true;
						}
					}
				}).catch(err=>{
					this.errMsg = "网络异常，请稍后重试！";
					this.errMsgShow = true;
					this.errMsgHide();
					this.isApiFlag = true;
				});
			},
			confirm(){//确认挂单
				this.$nextTick(()=>{
					this.$refs.min_loading.open('加载中，请稍后！');
				});
				offGoods({
					id: this.myGoodsDetails.payingId,
				}).then(res => {
					if (res.data.success) {
						this.$refs.uToast.show({type: 'success',message:"已成功取消挂单！"});
						this.myGoodsDetails.status = 1;
						this.cancelSsellShow = false;
					}else{
						this.errMsg = res.data.msg;
						this.errMsgShow = true;
						this.errMsgHide();
					}
				}).catch(err=>{
					this.errMsg = "网络异常，请稍后重试！";
					this.errMsgShow = true;
					this.errMsgHide();
				}).finally(() => {
					this.$refs.min_loading.close();
				});
			},
			cancelSell(){//取消挂单
				this.cancelSsellShow = true;
			},
			sellGoodsFn(){//立即挂单
				this.payShow = true;
				this.showType = 1;
				if(!this.$store.state.hasLogin){
					this.showType = 401;
					this.errMsg = "请先前往登录！";
					this.errMsgShow = true;
					this.errMsgHide();
					return;
				}
				if (this.$store.state.uerInfo.isRealName !== 1) {
					this.showType = 4;
					this.errMsg = "请先实名认证！";
					this.errMsgShow = true;
					this.errMsgHide();
					return;
				}
				if (!this.userAccount.payPsw) {
					this.showType = 100;
					this.errMsg = "请先设置支付密码！";
					this.errMsgShow = true;
					this.errMsgHide();
					return;
				} 
			},
			nextPas(){//下一步
				if(this.payPas.money == ""){
					this.errMsg = "请输入出售价格！";
					this.errMsgShow = true;
					this.errMsgHide();
				}else if(this.payPas.money < this.resaleCasting.fallStopPrice){//	跌停价
					this.errMsg = "出售价格不能小于"+this.resaleCasting.fallStopPrice+"！";
					this.errMsgShow = true;
					this.errMsgHide();
				}else if(this.payPas.money > this.resaleCasting.riseStopPrice){//	涨停价
					this.errMsg = "出售价格不能大于"+this.resaleCasting.riseStopPrice+"！";
					this.errMsgShow = true;
					this.errMsgHide();
				}else if(!this.isApiFlag){//	获取服务费
					this.errMsg = "正在获取服务费，请稍后！";
					this.errMsgShow = true;
					this.errMsgHide();
				}else{
					this.showType = 2;
					this.payPas.payPsw = "";
					this.payPas.setFocus = true;
				}
			},
			sellGoodsApi(){
				if(this.payPas.payPsw.length < 6) {
					this.errMsg = "请输入正确的转让密码！";
					this.errMsgShow = true;
					this.errMsgHide();
					return;
				};
				let pas = this.hrymd5.md5(this.payPas.payPsw);
				sellGoods({
					id: this.myGoodsDetails.id,
					payPsw:pas,
					price:this.payPas.money,
				}).then(res => {
					if (res.data.success) {
						this.$refs.uToast.show({type: 'success',message:"已在挂单中！"});
						this.myGoodsDetails.status = 2;
						this.showType = 1;
						this.payPas.payPsw = "";
						this.payPas.setFocus = false;
						this.payShow = false;
					}else{
						this.errMsg = res.data.msg;
						this.errMsgShow = true;
						this.errMsgHide();
					}
				}).catch(err=>{
					this.errMsg = "网络异常，请稍后重试！";
					this.errMsgShow = true;
					this.errMsgHide();
				});
			},
			
			errMsgHide(){
				clearTimeout(this.errMsgTime);
				this.errMsgTime = setTimeout(()=>{
					this.errMsgShow = false;
				},2000);
			},
			input_num() {
				const that = this;
				that.miney_list.forEach((item, index) => {
					for (var i = 0; i < that.payPas.payPsw.length; i++) {
						if (i == index) {
							that.miney_list[index].name = '*';
						}
					}
				})
			},
			guanbi() {//关闭出售弹窗
				this.payShow = false;
				this.showType = 1;
				this.payPas.setFocus = false;
				this.payPas.payPsw = "";
			},
			getAccount(){//账户余额   //转售市场开闭市信息查询
				getAccountData({}).then(res => {
					if (res.data.success) {
						let data = res.data.obj;
						this.userAccount = data;
					} else {
						this.$u.toast(res.data.msg);
					}
				}).catch(err => {
					this.$u.toast('网络错误');
				});
			},
			setImgShow(type){
				let n = "";
				if(type.coverImg){
					if((type.coverImg).indexOf(".mp4") !=-1){
						n = 2;
					}else if((type.coverImg).indexOf(".glb") !=-1){
						n = 3;
					}else{
						n = 1;
					}
				}
				return n;
			},
			// wx api 注册
			getConfig() {
				var ua = window.navigator.userAgent.toLowerCase();
				getWeixinConfig({}).then(res => {
					if (res.data.success) {
						let configData = res.data.obj;
						this.goAppletUrl = configData.split(',')[2];
						if (ua.match(/MicroMessenger/i) == 'micromessenger') { // 微信中打开
							this.isWxOpen = true;
							this.$nextTick(() => {
								let timestamp = new Date().getTime(),
									webUrl = location.origin;
								let signature = `jsapi_ticket=${configData.split(',')[1]}&noncestr=cdwjsszcpjypth5noncestr&timestamp=${timestamp}&url=${webUrl}`;
								
								wx.config({
									debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
									appId: "wx6320d1a81129e420", // 必填，公众号的唯一标识，填自己的！
									timestamp:timestamp, // 必填，生成签名的时间戳
									nonceStr: "cdwjsszcpjypth5noncestr", // 必填，生成签名的随机串
									signature:sha1(signature), // 必填，签名
									jsApiList: ['wx-open-launch-weapp'],
									// ,'showMenuItems','scanQRCode','openEnterpriseChat', 'openEnterpriseContact'
									openTagList: ['wx-open-launch-weapp'] // 跳转小程序时必填
								});
								
								wx.ready(res => {
									let btn = document.getElementById('launch-btn');
									btn.addEventListener('launch', e => {
										console.log('success');
									});
									btn.addEventListener('error', e => {
										alert('小程序打开失败');
										console.log('fail', e.detail);
									});
								});
								
								wx.error(error => {
									console.log(error);
								});
							});
						} else { // 普通浏览器中打开
							this.isWxOpen = false;
						}
					}else{
						
					}
				}).catch(err=>{});
			},
			goApplet(i){
				if(i == 0){
					location.href = this.goAppletUrl;
				}else{
					this.$u.toast("开发中，敬请期待！");
					return;
				}
			},
			close() {
				this.show = false;
			},
			// 判断这个地址是视频还是图片
			isImage(url) {
				if(url){
					let filePath = url.toLocaleLowerCase();
					if (filePath.indexOf(".mp4") != -1) {
						return false;
					} else {
						return true;
					}
				}else{
					return
				}
				
			},
			back() {
				let canNavBack = getCurrentPages();
				if(canNavBack && canNavBack.length>1) {  
				    if(this.setImgShow(this.myGoodsDetails) == 3){
						uni.redirectTo({
							url:("/"+canNavBack[1].route)
						});
				    }else{
				    	uni.navigateBack({
				    		delta: 1,
				    	});
				    }
				} else {  
				    history.back();  
				}
			},
		},
		onUnload() {
			this.move();
		}
	}
</script>

<style lang="scss" scoped>
	.con-box {
		padding-top: 120upx;
		padding-bottom: 80upx;
		.model3dPopup{
			width: 96vw;
			height: 600upx;
			border-radius: 20upx;
			position: relative;
			overflow: hidden;
			.iframeBox{
				width: 100%;
				height: 100%;
				border-radius: 20upx;
				border: 0 none;
			}
		}
		.shop_tips{
			background-color: #fff;
			border-radius: 10upx;
			text-align: center;
			font-size: 30upx;
			padding-bottom: 40upx;
			.tip-text{
				color: #2C1769;
				font-weight: bold;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 116upx;
			}
			.cont{
				color: #666;
				margin-top: 50upx;
				padding-bottom: 150upx;
			}
			.tip-title{
				color: #333;
				font-weight: 800;
				padding-top: 60upx;
			}
		}
		.toastBox{
			position: fixed;
			top: 50%;
			left: 50%;
			z-index: 99999;
			width: auto;
			max-width: 600upx;
			font-size: 24upx;
			padding: 16upx 30upx;
			transform: translate(-50%,-50%);
			background-color: #000;
			border-radius: 10upx;
			color: #fff;
		}
		.modeTitle{
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 30upx;
			padding: 0 30upx;
			color: #fff;
			height: 100upx;
			background-color: #2C1769;
		}
		.payPasTitle{
			font-size: 40upx;
			color: #2C1769;
			position: relative;
			background-color: #fff;
			.closeIcon{
				position: absolute;
				top: 30upx;
				right: 30upx;
			}
			text{
				padding-top: 30upx;
				font-weight: 800;
				display: block;
				text-align: center;
			}
		}
		
		.shop-tips {
			background-color: #fff;
			min-height:760upx;
			position: relative;
			.step1{
				padding-top: 170upx;
				text{
					display: block;
					margin-top: 30upx;
					color: #333;
					font-size: 30upx;
				}
			}
			.step2{
				padding: 0 30upx;
				padding-bottom: 150upx;
				.tips{
					font-size: 24upx;
					color: #666;
					line-height: 34upx;
					margin-top: 22upx;
					margin-bottom: 10upx;
				}
				.itemBox{
					display: flex;
					justify-content: space-between;
					align-items: center;
					height: 64upx;
					font-size: 24upx;
					>view{
						color: #333;
						display: flex;
						align-items: center;
						justify-content: center;
						.iconfs{margin-left: 10upx;}
					}
					text{color: #999;}
				}
				.priceCont{
					font-size: 24upx;
					color: #999;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					line-height: 24upx;
					margin-bottom: 40upx;
					text{
						display: inline-block;
						color: #EB5703;
					}
					.iconfs{margin-left: 16upx;}
				}
				.goods{
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding-bottom: 30upx;
					.info{
						flex: 1%;
						text-align: left;
						display: flex;
						flex-wrap: wrap;
						align-content: space-between;
						min-height: 160upx;
						padding: 10upx 0;
						padding-left: 20upx;
						.name{
							font-size: 34upx;
							color: #111;
							width: 100%;
						}
						text{
							font-size: 24upx;
							color: #666;
						}
					}
					image{
						width: 160upx;
						height: 160upx;
						border-radius: 10upx;
					}
				}
				.items{
					display: flex;
					justify-content: space-between;
					align-items: center;
					height: 64upx;
					>text{
						font-size: 24upx;
						color: #333;
					}
					.address{
						color: #999;
						font-size: 24upx;
					}
					.myMoney{
						color: #EB5703;
						font-size: 24upx;
					}
					.price{
						font-size:24upx;
						text-align: right;
						input{
							color: #EB5703;
							font-size: 24upx;
						}
					}
					.numb{
						display: flex;
						justify-content: flex-end;
						input{
							width: 50upx;
							font-size: 24upx;
							color: #333333;
							line-height: 40upx;
							height: 40upx;
							margin: 0 10upx;
						}
						text{
							font-size: 24upx;
							display: inline-block;
							width: 40upx;
							line-height: 40upx;
							height: 40upx;
							background-color: #666;
							color: #fff;
						}
					}
				}
			}
			.step3{
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 50upx;
				margin-top: 100upx;
				
				.password {
					width: 100%;
					height: 100upx;
					position: relative;
					.flex{
						display: flex;
						align-items: center;
						justify-content: space-between;
						.password_num {
							width: 100upx;
							height: 100upx;
							line-height: 100upx;
							display: flex;
							align-items: center;
							justify-content: center;
							background-color:#999;
							.inputCont{
								display: flex;
								align-items: center;
								.miney_data {
									width: 20upx;
									height: 20upx;
									background-color: #000000;
									border-radius: 50%;
								}
							}
							
						}
					}
				}
			
				.password input {
					width: 100%;
					height: 100%;
					position: absolute;
					top: 0;
					left: 0;
					opacity: 0;
				}
			}
			
			.footBn{
				width: 100%;
				padding: 0 30upx;
				position: absolute;
				bottom: 40upx;
				left: 0;
				>view{
					font-size: 30upx;
					color: #fff;
					text-align: center;
					line-height: 80upx;
					height: 80upx;
				}
				.style1{
					background-color: #999;
				}
				.style2{
					background-color: #eb5703;
				}
			}
			.tip-image {
				width: 100%;
				text-align: center;
				image {
					width: 132upx;
					height: 132upx;
				}
			}
		}
		.shop-tipsBox{
			background-color: #fff;
			text-align: center;
			border-radius: 10upx;
			padding: 30upx 0;
			box-shadow: 0 0 6px 3px rgba(0,0,0,0.1);
			.tip-title{
				font-size: 26upx;
				padding: 0 20upx;
			}
			.tip-text{
				padding: 0 58upx;
				margin-top: 40upx;
				.text{
					background-color: #2c1769;
					color: #fff;
					font-size: 24upx;
					line-height: 50upx;
					height: 50upx;
					border-radius: 6upx;
				}
			}
		}
		.logoBox{
			width: 100%;
			height: 100%;
			.navBox{
				height: 120upx;
				background-image: url("@/static/common/bg1.png");
				background-size: 100% 100%;
				background-repeat: no-repeat;
				display: flex;
				align-items: center;
				justify-content: center;
				color: #fff;
			}
		}
		.goods-image {
			width: 100%;
			position: relative;
			>view{
				width: 100%;
				height: 716upx;
				overflow: hidden;
				position: relative;
				.iframeBox{
					width: 100%;
					height: 100%;
					border: 0 none;
				}
				.model3d{
					position: absolute;
					bottom: 108upx;
					left: 50%;
					width: 100upx;
					margin-left: -50upx;
					z-index: 3;
				}
				.mask{
					position: absolute;
					top: 0;
					left: 0;
					width: 100%;
					height: 100%;
					z-index: 2;
				}
			}
			.img {
				width: 100%;
				height: 100%;
				display: block;
			}
		
			.videoBox {
				width: 100%;
				display: block;
				height:716upx;
				max-height: 716upx;
				/deep/.uni-video-container{
					background-color: transparent;
				}
			}
		}
		.operating {
			width: 100%;
			position: fixed;
			bottom: 0;
			left: 0;
			z-index: 9;
			height: 132upx;
			background-color: #EB5703;
			color: #fff;
			.footBox{
				height: 100%;
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 36upx;
				.footLeft{
					color: #fff;
					font-size: 30upx;
				}
				.shopping0{
					height: 62upx;
					border: 1px solid #FFFFFF;
					border-radius: 31upx;
					padding: 0 40upx;
					text-align: center;
					line-height: 62upx;
				}
				.shopping1{
					padding: 0 40upx;
					font-size: 29upx;
					height: 54upx;
					background: #B5B5B5;
					border-radius: 27upx;
					line-height: 54upx;
					position: relative;
					.iconfs{
						position: absolute;
						top: -26upx;
						right: -10upx;
					}
				}
			}
		}
		.goods-desc {
			width: 100%;
			height: auto;
			padding-bottom: 60upx;
			margin-top: -80upx;
			position: relative;
			z-index: 2;
			.goods_details{
				text-align: center;
				position:relative;
				background-color: #fff;
				padding: 0 30upx;
				padding-bottom: 20upx;
				border-top-left-radius: 25upx;
				border-top-right-radius: 25upx;
				.title{
					display: flex;
					align-items: center;
					justify-content: flex-start;
					padding-top: 28upx;
					padding-bottom: 26upx;
					view{
						display: flex;
						align-items: center;
						justify-content: center;
						height: 100%;
						background: #e3e4e7;
						color: #666;
						font-size: 24upx;
						text-align: center;
						line-height: 32upx;
						padding: 0 15upx;
						margin-right: 30upx;
						.text{
							background: #f3f1f1;
							color: #EB5703;
							display: inline-block;
							height: 100%;
							padding: 0 16upx;
							margin-left: 15upx;
						}
					}
				}
				.name{
					display: flex;
					align-items: flex-start;
					justify-content: space-between;
					width:100%;
					margin-bottom: 30upx;
					text{
						flex: 1%;
						display: inline-block;
						text-align: left;
						font-size: 30upx;
						color:#111;
						padding-right: 84upx;
					}
					view{
						image{
							width:26upx;
						}
					}
					
				}
			}
			.infoBox{
				margin-top: 15upx;
				background-color: #fff;
				padding:4upx 30upx;
				font-size: 24upx;
				>view{
					color: rgba($color: #414141, $alpha: 0.61);
					padding-top: 32upx;
					padding-bottom: 30upx;
					border-bottom: 1px solid #F7F7F7;
					text{
						color: #414141;
						margin-left: 38upx;
					}
				}
				.code{
					display: flex;
					justify-content: space-between;
					align-items: center;
					.rCont{
						display: flex;
						justify-content: center;
						align-items: center;
						font-size: 24upx;
						color: #414141;
						text{margin-right: 10upx;}
					}
				}
				view:last-child{border: 0 none;}
			}
			.scrollIssuer {
				width: 100%;
				display: flex;
				justify-content: flex-start;
				flex-wrap: wrap;
				margin-top: 15upx;
				background-color: #fff;
				padding:8upx 30upx;
				.holder-info {
					display: flex;
					align-items: center;
					justify-content: space-between;
					width: 100%;
					border-bottom: 1px solid #F7F7F7;
					padding-top: 26upx;
					padding-bottom: 16upx;
					.contLeft{
						display: flex;
						align-items: center;
						justify-content: flex-start;
					}
					.img {
						border-radius: 50%;
						height: 40upx;
						width: 40upx;
						box-shadow: 0 0 6px 3px rgba(0,0,0,0.1);
					}
					.desc {
						padding-left:10upx;
						.desc_1 {
							font-family: PingFang SC;
							font-size: 24upx;
							color: #414141;
							text{
								font-size: 18upx;
								background-color: #2b267f;
								color: #fff;
								display: inline-block;
								height: 24upx;
								padding: 0 12upx;
								line-height: 24upx;
								text-align: center;
								border-radius: 20upx;
								margin-left: 17upx;
							}
						}
										
						.desc_2 {
							font-family: PingFang SC;
							font-size: 16upx;
							color: rgba($color: #414141, $alpha: 0.42);
							width: 100%;
						}
					}
				}
				.holder-info:last-child{
					border: 0 none;
				}
			}
			.privilegeBox{
				margin-top: 15upx;
				background-color: #fff;
				padding:0upx 30upx;
				padding-bottom: 40upx;
				.titles{
					font-size: 30upx;
					color: #111;
					font-weight: 800;
					padding-top: 32upx;
					padding-bottom: 36upx;
				}
				.contents{
					display: flex;
					align-items: center;
					justify-content:space-between;
					padding: 0 40upx;
					.privilege{
						text-align: center;
					}
				}
				image{
					width: 58upx;
				}
			}
			.image-desc {
				width: 100%;
				height: auto;
				background-color: #fff;
				padding-bottom: 42upx;
				margin-bottom:20upx;
				margin-top: 15upx;
				overflow: hidden;
				.title1{
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding:0upx 30upx;
					padding-top: 32upx;
					padding-bottom: 36upx;
					.name{
						color: #111;
						font-weight: 800;
						font-size: 30upx;
					}
					.more{
						color: #666;
						font-size: 24upx;
					}
				}
				.circulationRecord{
					padding:0upx 30upx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					border-bottom: 1px solid #F7F7F7;
					padding-bottom: 20upx;
					padding-top: 10upx;
					.lCont{
						display: flex;
						align-items: center;
						.tag{
							display: inline-block;
							padding: 0 12upx;
							height: 30upx;
							background: #2C1769;
							border-radius: 15upx;
							font-size: 20upx;
							line-height: 30upx;
							color: #fff;
							margin-right: 10upx;
						}
						.date{
							display: inline-block;
							font-size: 24upx;
							line-height: 24upx;
							color: #666;
						}
					}
					.rCont{
						display: inline-block;
						font-size: 24upx;
						line-height: 24upx;
						color: #666;
					}
					.lCont1{
						display: flex;
						flex-wrap: wrap;
						justify-content: flex-start;
						.name{
							width: 100%;
							display: inline-block;
							line-height: 24upx;
							color: #333;
							font-size: 24upx;
							margin-bottom: 10upx;
						}
						.date{
							display: inline-block;
							font-size: 24upx;
							line-height: 24upx;
							color: #666;
						}
					}
					.rCont1{
						display: inline-block;
						font-size: 24upx;
						line-height: 24upx;
						color: #333;
					}
				}
				.noBorder:last-child{
					border: 0 none;
					padding-bottom: 0;
				}
				.title{
					font-size: 30upx;
					color: #111;
					font-weight: 800;
					padding:0upx 30upx;
					padding-top: 32upx;
					padding-bottom: 36upx;
				}
				.show-image {
					width: 100%;
					margin-bottom: 26upx;
					height: auto;
					padding:0upx 18upx;
					.img {
						width: 100%;
					}
				}
				.show-image:last-child{margin-bottom: 0;}
			}
			
		}
		.prize {
			width: 100%;
			height: 680upx;
			position: relative;
			background: #fff;
			color: #333;
			.prizeTitle {
				width: 100%;
				height: 88upx;
				font-size: 30upx;
				font-family: Microsoft YaHei;
				background: #2c1769;
				font-weight: 400;
				padding-left: 30upx;
				color: #FFFFFF;
				line-height: 88upx;
				text-align: left;
			}
		
			.prizeBox {
				margin: 30upx 0 22upx 0;
				.msg {
					width: 100%;
					text-align: center;
					color: #999;
					font-size: 24upx;
					margin-top: 30upx;
					padding-bottom: 20upx;
				}
		
				.prizeList {
					padding: 0 30upx;
					height: 100%;
					width: 100%;
					.noData{
						height: 100%;
						width: 100%;
						display: flex;
						justify-content: center;
						align-items: center;
						.noDataImg{
							width: 300upx;
						}
					}
					.codeItem{
						display: flex;
						justify-content: space-between;
						align-items: center;
						border-bottom: 1px solid #F7F7F7;
						padding: 18upx 0;
						font-size: 24upx;
						.codeCont{
							>text{
								display: block;
								line-height: 24upx;
								margin-bottom: 10upx;
								color: #666;
							}
							.price{
								line-height: 24upx;
								color: #EB5703;
								>text{
									margin-left: 10upx;
									font-size: 18upx;
									line-height: 24upx;
								}
							}
						}
						.status{
							>text{
								display: inline-block;
								color: #fff;
								padding: 0 20upx;
								line-height: 38upx;
								text-align: center;
								height: 38upx;
								background: #EB5703;
								border-radius: 5upx;
							}
						}
						.status1{
							>text{
								display: inline-block;
								color: #fff;
								padding: 0 20upx;
								line-height: 38upx;
								text-align: center;
								height: 38upx;
								background: #999;
								border-radius: 5upx;
							}
						}
					}
					.prizeItem {
						display: flex;
						justify-content: space-between;
						align-items: center;
						border-bottom: 1px solid #F7F7F7;
						padding: 18upx 0;
						font-size: 24upx;
						color: #333;
						.prizeRecord{
							display: flex;
							align-items: center;
							text{
								display: inline-block;
								height: 30upx;
								line-height: 30upx;
								background: #2C1769;
								border-radius: 15upx;
								font-size: 20upx;
								padding: 0 12upx;
								text-align: center;
								color: #fff;
								margin-right: 10upx;
							}
						}
						.prizeText1{
							padding-right: 38upx;
						}
						.nameCt{
							text-align: left;
							view{
								color: #666;
							}
						}
					}
				}
			}
		}
	}
</style>